let DateUtil = require("../../../utils/dateUtil");

function NiuniuResult() {
    this.uid = 0;
    this.score = 0;
    this.niuniuType = 0;
    this.cards = "";
}

NiuniuResult.prototype.toBSON = function() {
    return {
        uid : this.uid,
        score: this.score,
        niuniuType : this.niuniuType,
        cards : this.cards,
    };
};

NiuniuResult.prototype.toJSON = function () {
    return {
        uid : this.uid,
        score: this.score,
        niuniuType : this.niuniuType,
        cards : this.cards,
    };
};

module.exports.create = function(uid, score, niuniuType, cards) {
    let result = new NiuniuResult();
    result.uid = uid;
    result.score = score;
    result.niuniuType = niuniuType;
    result.cards = cards;
    return result;
};

module.exports.loadFromDocument = function (document) {
    let result = new NiuniuResult();
    result.uid = document["uid"];
    result.score = document["score"];
    result.niuniuType = document["niuniuType"];
    result.cards = document["cards"];
    return result;
};
